#!/usr/bin/python
#-*-<coding=UTF-8>-*-

"""
本例主要展示了sizer的用法.
"""

import wx

class BlockWindow(wx.Panel):
    """
        This is class explaner

        This is detail info for this class
    """
    def __init__(self,parent,id=-1,label="",pos=wx.DefaultPosition,size=(100,25)):
        wx.Panel.__init__(self,parent,id,pos,size,wx.RAISED_BORDER,label)
        self.label = label
        self.SetBackgroundColour("white")
        self.SetMinSize(size)
        self.Bind(wx.EVT_PAINT,self.OnPaint)

    def OnPaint(self,event):
        sizer = self.GetClientSize()
        dc = wx.PaintDC(self)
        w,h = dc.GetTextExtent(self.label)
        dc.SetFont(self.GetFont())
        dc.DrawText(self.label,(sizer.width-w)/2,(sizer.height-h)/2)

